package cn.hdu.liang.concurrency;

import java.util.concurrent.TimeUnit;

class ADaemon implements Runnable {
    @Override
    public void run() {
        try {
            System.out.println("开始ADaemon");
            TimeUnit.SECONDS.sleep(1);
        } catch(InterruptedException e) {
            System.out.println("被打断");
        } finally {
            System.out.println("总是要运行");
        }
    }
}

public class DaemonsDontRunFinally {
    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(new ADaemon());
        t.setDaemon(true);
        t.start();
        TimeUnit.MILLISECONDS.sleep(200);
    }
}
